<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- .stop防止事件冒泡 -->
    <div id="hello" @click="fumethod">
        <button @click.stop='zimethod'>子按钮</button>
        <form action="baidu">

    <!-- .prevent阻止默认事件发生 -->
            <input type="submit" value="提交" @click.prevent='tijiao()'>
        </form>

        <!-- .键别名 键ascll码 -->
    <!-- http://www.asciima.com/ascii/1.html 键盘码表 -->
    <!-- .once 只会触发一次 -->
        <input  @keyup.enter.once='keyUp'>
        
    </div>
    <script src="../vue.js"></script>
    <script>
        const vue01 = new Vue({
            el: '#hello',
            methods: {
                fumethod() {
                    console.log('父方法')
                },
                zimethod() {
                    console.log('子方法运行的时候，父事件也会被执行')
                },
                tijiao(){
                    console.log('提交方法')
                },
                keyUp(){
                    alert('按了enter');
                }
            },
        })
    </script>


   
    </script>
</body>

</html>